package drds.server.sqlparser.sqlobject.statement.update;

import drds.server.sqlparser.sqlobject.AbstractSqlObject;
import drds.server.sqlparser.sqlobject.expression.Expression;
import drds.server.sqlparser.visitor.Visitor;

/**
 * 
 * @author 曹正辉<330937205@qq.com>
 * 
 */
public class UpdateSetItem extends AbstractSqlObject {

	private Expression columnName;
	private Expression value;

	public UpdateSetItem() {

	}

	public void setColumnName(Expression columnName) {
		this.columnName = columnName;
	}

	public Expression getColumnName() {
		return columnName;
	}

	public Expression getValue() {
		return value;
	}

	public void setValue(Expression value) {
		this.value = value;
	}

	public void output(StringBuffer sb) {
		columnName.output(sb);
		sb.append(" = ");
		value.output(sb);
	}

	@Override
	protected void accept0(Visitor visitor) {
		if (visitor.visit(this)) {
			acceptChild(visitor, columnName);
			acceptChild(visitor, value);
		}

		visitor.endVisit(this);
	}

}
